#include "test.h"
#include <iostream>
#include <opencv2\opencv.hpp>

using namespace std;
using namespace cv;

int test06(int argc, char** argv)
{
	double alpha = 0.5;
	double beta, input;

	Mat src1, src2, dst;

	cout << "Enter alpha (0-1): ";
	cin >> input;

	if (input >= 0 && input <= 1)
		alpha = input;

	src1 = imread("C:\\ProgramsOrTools\\OpenCV2.4.3\\samples\\cpp\\baboon.jpg");
	src2 = imread("C:\\ProgramsOrTools\\OpenCV2.4.3\\samples\\cpp\\lena.jpg");

	if (!src1.data || !src2.data)
	{
		cout << "Fail" << endl;
		return -1;
	}

	namedWindow("Linear blend", WINDOW_AUTOSIZE);
	beta = 1.0 - alpha;

	//alpha*src1 + beta*src2 + gamma
	addWeighted(src1, alpha, src2, beta, 0.0, dst);
	imshow("Linear blend", dst);

	waitKey(0);
	return 0;
}
